﻿$(function () {

    // 获取当前页面的ID
    var pathname = window.location.pathname;

    // 会员中心
    if(pathname.indexOf("userInfo") >=0 ){
        document.getElementById('ulUserCenter').style.display = 'block';
        $("#linkUserInfo").addClass("active");
        document.getElementById("bannerImage").style.background = "url(../img/template/userCenter.jpg)";

    // 车辆资料
    }else if ( pathname.indexOf("carData") >=0 ){
        document.getElementById('ulUserCenter').style.display = 'block';
        $("#linkVehicleInformation").addClass("active");
        document.getElementById("bannerImage").style.background = "url(../img/template/userCenter.jpg)";
    // 地址管理
    }else if ( pathname.indexOf("queryAddress") >=0 ){
        document.getElementById('ulUserCenter').style.display = 'block';
        $("#linkAddress").addClass("active");
        document.getElementById("bannerImage").style.background = "url(../img/template/userCenter.jpg)";
    // 年检介绍
    }else if ( pathname.indexOf("introduction") >=0 ){
        document.getElementById('ulIntelligentVehicle').style.display = 'block';
        $("#linkIntroduction").addClass("active");
        document.getElementById("bannerImage").style.background = "url(../img/template/intelligentVehicle.jpg)";
    // 车辆自检
    }else if ( pathname.indexOf("selfCheck") >=0 ){
        document.getElementById('ulIntelligentVehicle').style.display = 'block';
        $("#linkSelfCheck").addClass("active");
        document.getElementById("bannerImage").style.background = "url(../img/template/intelligentVehicle.jpg)";
    // 预约检车
    }else if ( pathname.indexOf("searchStation") >=0 ){
        document.getElementById('ulIntelligentVehicle').style.display = 'block';
        $("#linkSearchStation").addClass("active");
        document.getElementById("bannerImage").style.background = "url(../img/template/intelligentVehicle.jpg)";
    // 检测站详情
    }else if ( pathname.indexOf("stationDetail") >=0 ){
        document.getElementById('ulIntelligentVehicle').style.display = 'block';
        $("#linkSearchStation").addClass("active");
        document.getElementById("bannerImage").style.background = "url(../img/template/intelligentVehicle.jpg)";
    // 检测报告
    }else if ( pathname.indexOf("detectReport") >=0 ){
        document.getElementById('ulMyVehicle').style.display = 'block';
        $("#linkDetectReport").addClass("active");
        document.getElementById("bannerImage").style.background = "url(../img/template/myVehicle.jpg)";
     // 车况分析
    }else if ( pathname.indexOf("vehicleState") >=0 ){
        document.getElementById('ulMyVehicle').style.display = 'block';
        $("#linkVehicleState").addClass("active");
        document.getElementById("bannerImage").style.background = "url(../img/template/myVehicle.jpg)";
    // 法律法规
    }else if ( pathname.indexOf("laws") >=0 ){
        document.getElementById('ulNewsNous').style.display = 'block';
        $("#linkLaws").addClass("active");
        document.getElementById("bannerImage").style.background = "url(../img/template/newsNous.jpg)";
    // 公司新闻
    }else if ( pathname.indexOf("news") >=0 ){
        document.getElementById('ulNewsNous').style.display = 'block';
        $("#linkNous").addClass("active");
        document.getElementById("bannerImage").style.background = "url(../img/template/newsNous.jpg)";
    // 行业资讯
    }else if ( pathname.indexOf("industry") >=0 ){
        document.getElementById('ulNewsNous').style.display = 'block';
        $("#linkNewsIndustry").addClass("active");
        document.getElementById("bannerImage").style.background = "url(../img/template/newsNous.jpg)";
    // 公司简介
    }else if ( pathname.indexOf("about") >=0 ){
        document.getElementById('ulAboutUs').style.display = 'block';
        $("#linkAbout").addClass("active");
        document.getElementById("bannerImage").style.background = "url(../img/template/aboutUs.jpg)";
        // 服务理念
    }else if ( pathname.indexOf("service") >=0 ){
        document.getElementById('ulAboutUs').style.display = 'block';
        $("#linkService").addClass("active");
        document.getElementById("bannerImage").style.background = "url(../img/template/aboutUs.jpg)";
    // 企业文化
    }else if ( pathname.indexOf("culture") >=0 ){
        document.getElementById('ulAboutUs').style.display = 'block';
        $("#linkCulture").addClass("active");
        document.getElementById("bannerImage").style.background = "url(../img/template/aboutUs.jpg)";
    }else if ( pathname.indexOf("contact") >=0 ){
        document.getElementById('ulAboutUs').style.display = 'block';
        $("#linkContact").addClass("active");
        document.getElementById("bannerImage").style.background = "url(../img/template/aboutUs.jpg)";
    }

    //if (pathname.indexOf("test1") >=0 ){
    //    document.getElementById('ulAboutUs').style.display = 'block';
    //    $("#linkAbout").addClass("active");
    //}

    // 用户管理
    $("#btnUserCenter").click(function () {

        if (document.getElementById('ulUserCenter').style.display == 'none'){
            document.getElementById('ulUserCenter').style.display = 'block';
        }else{
            document.getElementById('ulUserCenter').style.display = 'none';
        }
    });

    // 智能检车
    $("#btnIntelligentVehicle").click(function () {

        if (document.getElementById('ulIntelligentVehicle').style.display == 'none'){
            document.getElementById('ulIntelligentVehicle').style.display = 'block';
        }else{
            document.getElementById('ulIntelligentVehicle').style.display = 'none';
        }
    });

    // 我的车况
    $("#btnMyVehicle").click(function () {

        if (document.getElementById('ulMyVehicle').style.display == 'none'){
            document.getElementById('ulMyVehicle').style.display = 'block';
        }else{
            document.getElementById('ulMyVehicle').style.display = 'none';
        }
    });

    // 新闻资讯
    $("#btnNewsNous").click(function () {

        if (document.getElementById('ulNewsNous').style.display == 'none'){
            document.getElementById('ulNewsNous').style.display = 'block';
        }else{
            document.getElementById('ulNewsNous').style.display = 'none';
        }
    });

    // 关于我们
    $("#btnAboutUs").click(function () {

        if (document.getElementById('ulAboutUs').style.display == 'none'){
            document.getElementById('ulAboutUs').style.display = 'block';
        }else{
            document.getElementById('ulAboutUs').style.display = 'none';
        }
    });
})